-- -- Copyright 2014 Alessandro Gerlinger Romero -- -- This file is part of Hybrid fUML. -- -- Hybrid fUML is free software: you can redistribute it and/or modify -- it under the terms of the GNU General Public License as published by -- the Free Software Foundation, either version 3 of the License, or -- (at your option) any later version. -- -- Hybrid fUML is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -- GNU General Public License for more details. -- -- You should have received a copy of the GNU General Public License -- along with Hybrid fUML. If not, see . -- ------------------------------------------------------------------------------------------------------------------------------------------------------------ -- APPROACH -- Define types for stereotypes that can be used in a model compliant with current version -- generate two functions for each keyclassifer -- function_<>_AppliedStereotype :: <> -> Stereotype -- function_<>_EnumerationValueForAppliedStereotype :: <> -> Stereotype -> StereotypeTag -> StereotypeTagValue data Stereotype = Pausable | NonBlockable | DiscreteDomain | ContinuousDomain | ModelicaConnection | ModelicaConnector | ModelicaEquation | ModelicaValueProperty | ModelicaPort | ClockConstraint | Clock | Edge | Previous | PrecededBy | StereotypeUndef instance AsmTerm Stereotype where asmDefault = StereotypeUndef instance Ord Stereotype where (<=) a b = ((findPos list a) < (findPos list b) || a == b) where list :: [Stereotype] list = [Pausable, NonBlockable, DiscreteDomain, ContinuousDomain, ModelicaConnection, ModelicaConnector, ModelicaEquation, ModelicaValueProperty, ModelicaPort, Clock, ClockConstraint, Edge, Previous, PrecededBy, StereotypeUndef] findPos :: [Stereotype] -> Stereotype -> Int findPos list elem | head list == elem = 0 | otherwise = 1 + (findPos (tail list) elem) data StereotypeTag = FlowFlag | Variability | InitialValue | StereotypeTagUndef instance AsmTerm StereotypeTag where asmDefault = StereotypeTagUndef instance Ord StereotypeTag where (<=) a b = ((findPos list a) < (findPos list b) || a == b) where list :: [StereotypeTag] list = [FlowFlag, Variability, InitialValue, StereotypeTagUndef] findPos :: [StereotypeTag] -> StereotypeTag -> Int findPos list elem | head list == elem = 0 | otherwise = 1 + (findPos (tail list) elem) data StereotypeTagValue = Flow | None | Continuous | Discrete | Parameter | Constant | StereotypeTagValueUndef instance AsmTerm StereotypeTagValue where asmDefault = StereotypeTagValueUndef instance Ord StereotypeTagValue where (<=) a b = ((findPos list a) < (findPos list b) || a == b) where list :: [StereotypeTagValue] list = [Flow, None, Continuous, Discrete, Parameter, Constant, StereotypeTagValueUndef] findPos :: [StereotypeTagValue] -> StereotypeTagValue -> Int findPos list elem | head list == elem = 0 | otherwise = 1 + (findPos (tail list) elem)